# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Bernhard Landauer <oberon@manjaro.org>
# Contributor: Alexsandr Pavlov <kidoz at mail dot ru>

_gemname=hoe
pkgname=ruby-${_gemname}
_gitcommit=d748e0d6a3f6235a8b23a39632ccaf8b35023ba5
pkgver=4.0.2
pkgrel=1
pkgdesc='Hoe is a rake/rubygems helper for project Rakefiles'
url='https://www.zenspider.com/projects/hoe.html'
arch=('any')
license=('MIT')
depends=('ruby')
makedepends=('git' 'ruby-rdoc' 'ruby-rake')
checkdepends=('ruby-minitest')
options=('!emptydirs')
source=("git+https://github.com/seattlerb/hoe#commit=${_gitcommit}")
sha512sums=('SKIP')

pkgver() {
  cd ${_gemname}
  grep 'VERSION = "' lib/hoe.rb|sed -E 's|.*"(.+)"|\1|'
}

build() {
  cd ${_gemname}
  rake gem
}

check() {
  cd ${_gemname}
  rake test
}

package() {
  cd ${_gemname}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" \
    -n "${pkgdir}/usr/bin" pkg/${_gemname}-${pkgver}.gem
  install -Dm 644 README.rdoc -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 README.rdoc -t "${pkgdir}/usr/share/licenses/${pkgname}"
  rm -rf cache gems/${_gemname}-${pkgver}/{ext,lib/*/*.so} \
    extensions/*/*/${_gemname}-${pkgver}/{mkmf.log,gem_make.out}
}

# vim: ts=2 sw=2 et:
